﻿using Connection.IModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Connection.Model
{
    [Serializable()]
    public class ConversationModel:IConversationModel
    {
        string _conversationId;
        string _fromUserId;
        DateTime _timeMess;
        string _message;
        ConversationDB _conversationdb = new ConversationDB();

        public string FromUserId
        {
            get { return _fromUserId; }
            set { _fromUserId = value; }
        }

        public string ConversationId
        {
            get { return _conversationId; }
            set { _conversationId = value; }
        }

        public DateTime TimeMess
        {
            get { return _timeMess; }
            set { _timeMess = value; }
        }

        public string Message
        {
            get { return _message; }
            set { _message = value; }
        }


        public void AddNewMessConversation()
        {
            string _sTimeMess = this.TimeMess.ToString("yyyy/MM/dd hh:mm:ss");
            _conversationdb.InsertConversation(this.ConversationId, _sTimeMess, this.FromUserId, this.Message);
        }
    }
}
